<%-- 
    Created on : 2019
    Author     : 黄忠
--%>

<%@page import="staffManager.StaffBean"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>个人信息管理系统->删除员工</title>
        <link rel="stylesheet" href="../CSS/infor.css">
    </head>
    <body bgcolor="CCCFFF">
    <br>
    <%@include file="searchStaff.jsp" %>
    <br>
        <%
            ArrayList staffslist=(ArrayList)session.getAttribute("staffslist");
            if(staffslist==null||staffslist.size()==0){
        %>
        <div align="center">
            <h1>公司还没有任何员工！</h1>
        </div>
        <%
        }else{
        %>
    <table  cellspacing="0" cellpadding="0" style="width: 99%;" align="center">
        <tr>
            <th>账号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>身份证</th>
            <th>民族</th>
            <th>学历</th>
            <th>职位</th>
            <th>基本月薪</th>
            <th>电话</th>
            <th>地址</th>
            <th>邮箱</th>
            <th>权限</th>
            <th>操作</th>
        </tr>
    </table>
    <table id="pageMain"  cellspacing="0" cellpadding="0" style="width: 99%;" align="center">
        <%
            for(int i=staffslist.size()-1;i>=0;i--){
                StaffBean ff=(StaffBean)staffslist.get(i);
                if(search){
                    if(!ff.getLevel().equals(level)&&!level.equals("全部")) continue;
                    if(!ff.getWork().equals(work)&&!work.equals("全部")) continue;
                    if(!ff.getEdu().equals(edu)&&!edu.equals("全部")) continue;
                }
        %>
        <tr class="hoverTr">
            <td><%=ff.getUserName()%></td>
            <td><%=ff.getName()%></td>
            <td><%=ff.getSex()%></td>
            <td><%=ff.getIdCard()%></td>
            <td><%=ff.getNation()%></td>
            <td><%=ff.getEdu()%></td>
            <td><%=ff.getWork()%></td>
            <td><%=ff.getMonthPay()%></td>
            <td><%=ff.getPhone()%></td>
            <td><%=ff.getPlace()%></td>
            <td><%=ff.getEmail()%></td>
            <td><%=ff.getLevel()%></td>
            <td><a href="#" onclick="deleteCall(<%="'"+ff.getUserName()+"'"%>)">删除</a></td>
        </tr>
        <%
                }
            }
        %>
    </table>
    </body>
    <%@include file="../page.jsp" %>
</html>
<script>
    function deleteCall(userName) {
        var result=confirm('您确定要删除'+userName+'吗？');
        if(result){
            window.open("http://localhost:8080/DeleteStaffServlet?userName="+userName,"main");
        }
    }
</script>

